package com.whp.openapi.web.controller;

import com.whp.openapi.common.ResponseResult;
import com.whp.openapi.common.ResultTable;
import com.whp.openapi.entity.Recharge;
import com.whp.openapi.service.ApiSystemparamService;
import com.whp.openapi.service.RechargeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author whp
 * @date 2021/11/26
 */
@RestController
@RequestMapping("/recharge")
public class RechargeController {
    
    @Autowired
    private RechargeService rechargeService;

    /**
     * 充值管理：搜索、分页
     * @param page
     * @param limit
     * @param name
     * @param state
     * @return
     */
    @RequestMapping("/table")
    public ResultTable table(@RequestParam(defaultValue = "1") Integer page,
                             @RequestParam(defaultValue = "10") Integer limit,
                             String name,
                             Integer state){
        return rechargeService.table(page, limit, name, state);
    }

    /**
     * 删除
     * @param ids
     * @return
     */
    @RequestMapping("/del")
    public ResponseResult delRecharge(Integer[] ids){
        return rechargeService.delRecharge(ids);
    }

    /**
     * 添加
     * @param recharge
     * @return
     */
    @RequestMapping("/add")
    public ResponseResult addRecharge(Recharge recharge){
        return rechargeService.addRecharge(recharge);
    }

    /**
     * 编辑
     * @param recharge
     * @return
     */
    @RequestMapping("/update")
    public ResponseResult updateRecharge(Recharge recharge){
        return rechargeService.updateRecharge(recharge);
    }
    
}
